<template>
	<view  style="background-color: #F8F8F8; overflow-x: hidden;" v-if="businessList">
		<view class="nav-back">
			<top-heigth backTitle="商户详情"></top-heigth>
		</view>
		<view class="content-box m-t24">
			<view class="public-box m-b16">
				<view class="detail-title">
					<view class="title-box">
						<view class="line"></view>
						<h1 class="title-h1">商户名称</h1>
					</view>
				</view>	
				<view class="detail-font">
					<view class="detail-font-box">
						<view class="detail-font-l"  @click="goShopDetail(businessList.id)">
							<span>营业执照：{{businessList.shopName}}</span>
							<uv-icon size="20" name="/static/image/more.png"></uv-icon>
						</view>
						<view class="detail-font-r">
							<!-- 如拨打不通 看是否需要引入以下内容 <meta name="format-detection" content="telephone=yes" /> -->
							<span @click='callPhone(businessList.shopTel)'>联系商家</span> 
							<!-- 图标未改 -->
							<uv-icon size="20" name="/static/image/more.png"></uv-icon>
						</view>
					</view>
				</view>
				<view class="detail-title" style="margin-top: 30rpx;">
					<view class="title-box">
						<view class="line"></view>
						<h1 class="title-h1">商户介绍</h1>
					</view>
					
				</view>	
				<view class="detail-font">
					{{businessList.shopDesc}}
				</view>
			</view>
			
		</view>
		<view class="content-box m-t24">
			<view class="public-box m-b16">
				<view class="business-title">
					<view @click="titleChange(1)" :class="num == 1 ? 'title-font choose':'title-font'">全部项目</view>
					<view @click="titleChange(2)" :class="num == 1 ? 'title-font':'title-font choose'">店铺技师</view>
				</view>
				
				<view v-if="num == 1" class="goods-box">
					<view v-for="item in list" class="goods border-b" @click="toServiceDetail(item.id)">
						<view class="img-box">
							<image class="img" :src="item.serviceImage" mode="widthFix"></image>
						</view>
						<view class="goods-font">       
							<h1 class="goods-h1">{{item.serviceName}}</h1>
							<view class="sale">销量 {{item.serviceBaseTime}}</view>
							<view class="font-bottom">
								<view class="font-bottom-l">
									<view class="red">
										<span class="goods-span-red">¥</span>{{item.serviceAmount}}
									</view>
									<view class="grey2">¥{{item.serviceOldAmount}}</view>
								</view>
								<view class="but-blue t-but">立即预约</view>
							</view>
						</view>
					</view>
					
				</view>
				
				<view v-if="num == 2">
					<view class="list-box2-big">
						<view class="list-box2" v-for="item in list2" @click="goDetail(item.id)">
							<view class="">
								<!-- <uv-icon size="22" name="/static/image/t-vip2.png" class="m-b8 t-vip"></uv-icon> -->
								<view class="list-head2">
									<view class="img-box">
										<image class="image" :src="item.staffCover" mode="widthFix"></image>
									</view>
									<!-- <view class="title title-blue">新人</view> -->
								</view>
							</view>
							<view style="width:calc(100% - 184rpx)">
								<view class="list-center-top">
									<view class="list-center">
										<h1>{{item.staffName}}</h1>
										<view class="time">
											<view class="time-b-red">最早可约</view>
											<view class="time-f-red">{{item.timeWork}}</view>
										</view>
									</view>
									
									<view>
										<view class="icon-font m-b8">
											<uv-icon size="16" name="/static/image/t-address.png" style="margin-right: 8rpx;"></uv-icon>
											<view class="shop">{{item.distance}}km</view>
										</view>
									</view>
								</view>
								
								<view class="list-bottom-box">
									<view class="list-bottom">
										<view class="font" style="margin-bottom: 8rpx;">
											<span>{{item.score}}分</span>服务单数 {{item.orderCount}}
										</view>
										
									</view>
									<view class="but-blue t-but">立即预约</view>
								</view>
							</view>
						</view>
					</view>
					
				</view>
			</view>
		</view>
		
		
		<view style="height: 50rpx;"></view>
	</view>
</template>

<script>
	import TopHeigth from '@/components/TopHeigth.vue'
	
	export default {
		data() {
			return {
				isShenhe: 1,
				num:1,
				id:'',
				list:[],
				list2:[],
				businessList: null,
				location: uni.getStorageSync('location')
			}
		},
		
		components: { TopHeigth },
		onLoad(e) {
			this.id = e.id
			this.businessBox()
			this.listBox()
			this.listBox2()
		},
		methods: {
			toServiceDetail(id){
				uni.navigateTo({
					url: "/pages/order/goodsDetail?id=" + id
				})
			},
			callPhone(phoneNumber) {
			  uni.makePhoneCall({
			  	phoneNumber: phoneNumber
			  });
			},
			//商户详情
			businessBox:function(){
				uni.$u.http.post('/api/shop/v1_0/tAppSupplierRCA/turnTAppSupplierInfo',{
					id:this.id,
				}).then((res) => {
					this.businessList = res.data
				})
			},
			//技师
			listBox2:function(){
				uni.$u.http.post('/api/shop/v1_0/tAppStaffRCA/queryTAppStaff',{
					id: this.isShenhe ? 1 : null,
					isAuthentication:1,
					checkStatus:1,
					supplierId:this.id,
					lat: this.location ? this.location.latitude : null,
					lng: this.location ? this.location.longitude : null,
				}).then((res) => {
					this.list2 = res.aaData
				})
			},
			//全部项目
			listBox:function(){
				uni.$u.http.post('/api/shop/v1_0/tAppServiceRCA/queryTAppService',{
					ison:this.id,
				}).then((res) => {
					this.list = res.aaData
			
				})
			},
			goShopDetail(id){
				uni.navigateTo({
					url: "/pages/technician/shopDetail?id="+id
				})
			},
			goDetail(id){
				uni.navigateTo({
					url: "/pages/technician/detail?id="+id
				})
			},
			titleChange(n){
				this.num = n
			},
			goback(){
				uni.navigateBack()
			},
		}
	}
</script>

<style lang="scss" scoped>
	@mixin flex($direction: row) {
		/* #ifndef APP-NVUE */
		display: flex;
		/* #endif */
		flex-direction: $direction;
	}
	.uv-nav-slot {
		@include flex;
		align-items: center;
		justify-content: space-between;
		border-width: 0.5px;
		border-radius: 100px;
		border-color: #dadbde;
		padding: 3px 7px;
		opacity: 0.8;
	}
	
	
	
	
	.detail-font{
		font-size: 26rpx;
		color: #666;
		line-height: 40rpx;
		span{
			margin-right: 20rpx;
		}
	}
	/* --------------- */
	
	
	
	
	.detail-font-box{
		display: flex;
		justify-content: space-between;
		.detail-font-l,.detail-font-r{
			display: flex;
			justify-content: flex-start;
		}
	}
	.business-title{
		display: flex;
		align-content: flex-start;
		.title-font{
			font-size:28rpx;
			color: #333;
			text-align: center;
			margin-right:40rpx;
			padding-bottom: 16rpx;
		}
		.choose{
			font-weight: bold;
			background: url("/static/image/title-line.png") no-repeat bottom center;
		}
	}
	
	
	/* ------------------------- */
	

	
	.list-box2-big{
		.list-box2{
			position: relative;
			border-radius:24rpx;
			padding: 32rpx 0;
			display: flex;
			justify-content: space-between;
			background-color: #fff;
			border-bottom: 2rpx solid #eee;
		}
		.list-box2:last-child{
			border-bottom:none;
		}
	}
	.list-head2{
		height:136rpx;
		width: 136rpx;
		background: #f8f8f8;
		margin-right: 24rpx;
		border-radius: 136rpx;
		position: relative;
		font-weight: bold;
		.img-box{
			height:136rpx;
			width: 136rpx;
			border-radius: 136rpx;
			overflow: hidden;
			@include flex;
			align-items: center;
			.image{
				width: 136rpx;
				height: 136rpx;
			}
		}
		
		.title{
			position: absolute;
			bottom:-8rpx;
			left: 80rpx;
			width: 104rpx;
			margin-left: -51rpx;
			height: 32rpx;
			color: #75391E;
			font-size: 20rpx;
			border-radius: 32rpx;
			padding: 2rpx 6rpx;
			text-align: center;
			background: linear-gradient(180deg, #FFF0D2 0%, #FFC874 100%);
		}
		.title-blue{
			color: #1665AA;
			background: linear-gradient(180deg, #BEF4FF 0%, #30D2FF 100%);
		}
	}
	
	.t-vip{
			position: absolute;
			top: 22rpx;
		}
	
	.list-center{
		/* width: calc(100% - 344rpx); */
		margin-right: 24rpx;
		h1{
			font-size: 30rpx;
			color: #333;
			font-weight: bold;
			margin-bottom: 8rpx;
		}
		.time{
			display: flex;
			justify-content: flex-start;
			font-size: 22rpx;
			margin-bottom: 8rpx;
			.time-b-red{
				height: 34rpx;
				line-height: 34rpx;
				color: #fff;
				background: #FF1818;
				border-radius: 4rpx;
				border: 2rpx solid #FF1818;
				z-index: 9;
				padding: 0 8rpx;
			}
			.time-f-red{
				height: 34rpx;
				line-height: 34rpx;
				color: #FF1818;
				background: rgba(255,0,0,0.08);
				border: 2rpx solid rgba(255,24,24,0.3);
				border-left: 0;
				border-radius: 0 4rpx 4rpx 0;
				margin-left: -2rpx;
				padding: 0 8rpx;
			}
		}
		
		
	}
	.list-bottom-box{
		display: flex;
		justify-content: space-between;
		align-items: flex-end;
	}
	.list-bottom{
		width: calc(100% - 200rpx);
		.font{
			color: #999999;
			font-size: 24rpx;
			span{
				color:#FFA23E;
				margin-right: 8rpx;
				font-weight: bold;
			}
		}
		.font-flex{
			display: flex;
			justify-content: flex-start;
			.shop{
				text-overflow: ellipsis;
				white-space: nowrap;
				overflow: hidden;
			}
		}
	}
	.list-center-top{
		width: 100%;
		display: flex;
		justify-content: space-between;
	}
	
	
	.icon-font{
		display: flex;
		justify-content: flex-end;
		color: #999999;
		font-size: 24rpx;
	}
	
	.list-box2{
		.t-but{
			margin: 0;
		}
	}
	
</style>
